import * as api from '.';

const certificateApi = {

  serverIps: async () => {
    return api.GET('/api/certificate/serverIps',  null, null);
  },

  find: async (id: string) => {
    return api.GET('/api/certificate/find/:id',  { id }, null);
  },

  query: async () => {
    return api.GET('/api/certificate/query', null, null);
  },

  add: async (companyId: string) => {
    return api.POST('/api/certificate/add/:companyId', { companyId }, null);
  },

  save: async (id: string, data: any[]) => {
    return api.POST('/api/certificate/save/:id', { id }, data);
  },

  delete: async (id: string) => {
    return api.DELETE('/api/certificate/delete/:id', { id }, null);
  },

  test: async (data: any) => {
    return api.POST('/api/certificate/test', null, data);
  },

  testByCompany: async (companyId: string, appType: string) => {
    const match: Record<string, any> = { companyId, appType };
    return api.POST('/api/certificate/test/:companyId/:appType', match, null);
  },

  testUsers: async (departmentId: string, data: any) => {
    return api.POST('/api/certificate/test/:departmentId', { departmentId }, data);
  }

};

export default certificateApi;
